home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 386 / insttest / pea_move.s < prev    next >
Text File  |  1985-11-19  |  2KB  |  66 lines

  1.  ; Program Name: PEA_MOVE.S
  2.  ;      Version: 1.001
  3.  
  4.  ; Assembly Instructions:
  5.  
  6.  ;    Assemble in PC-relative mode and save with a TOS extension.
  7.  
  8.  ; Program Function:
  9.  
  10.  ;    Compares the relative speed and memory requirements of "pea (a0)" to
  11.  ; that of "move.l a0, -(sp)".  The execution time reported is for
  12.  ; 50,000 executions of each instruction.
  13.  
  14.  ; Execution Note:
  15.  
  16.  ;    Invokes traps that are installed by CUSTOM.PRG during boot.
  17.  
  18. calculate_program_size:
  19.  lea        -$102(pc), a1       ; Fetch basepage start address.
  20.  lea        program_end, a0     ; Fetch program end = array address.
  21.  adda.l     #200512, a0         ; Add in extra large stack space.
  22.  movea.l    a0, a7              ; Point A7 to this program's stack.
  23.  trap       #6                  ; Return unused memory to op system.
  24.  
  25. initialize_registers_1:
  26.  lea        header_1, a0       
  27.  lea        header_2, a1
  28.  lea        pea_algorithm_start, a3
  29.  lea        pea_algorithm_end, a4
  30.  lea        heading, a5
  31.  move.w     #50000, d7
  32.  trap       #9
  33.  
  34. initialize_registers_2:
  35.  lea        header_3, a0       
  36.  lea        header_4, a1
  37.  lea        move_algorithm_start, a3
  38.  lea        move_algorithm_end, a4
  39.  lea        heading, a5
  40.  move.b     #0, (a5)            ; Store a NULL in first byte to create a
  41.  move.w     #50000, d7          ; null string so that heading gets printed
  42.  trap       #9                  ; only once.
  43.  
  44. terminate:
  45.  trap       #8
  46.  
  47. pea_algorithm_start:
  48.  pea        (a0)                ; Instruction in the loop.
  49. pea_algorithm_end:
  50.  
  51. move_algorithm_start:
  52.  move.l     a0, -(sp)           ; Instruction in the loop.
  53. move_algorithm_end:
  54.          
  55.  data
  56. heading:      dc.b       "PEA_MOVE Program Results",$D,$A,$D,$A,0
  57. header_1:     dc.b       "  Elapsed time for pea (a0):         ",0
  58. header_2:     dc.b       "  Memory required for pea (a0):         ",0
  59. header_3:     dc.b $D,$A,"  Elapsed time for move.l a0, -(sp): ",0
  60. header_4:     dc.b       "  Memory for move.l a0, -(sp)           ",0
  61.  bss
  62.  align                       
  63. program_end:  ds.l  0 
  64.  end
  65.  
  66.